package com.mocha.bss.domain.rbac.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mocha.bss.domain.rbac.repository.mapper.MochaRoleSensitiveMapper;
import com.mocha.bss.domain.rbac.repository.entity.RoleSensitiveEntity;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author songkui
 * @since 2022-03-11
 */
@Service
public class MochaRoleSensitiveRepository extends ServiceImpl<MochaRoleSensitiveMapper, RoleSensitiveEntity>  {

    protected final MochaRoleRepository mochaRoleRepository;

    public MochaRoleSensitiveRepository(MochaRoleRepository mochaRoleRepository) {
        this.mochaRoleRepository = mochaRoleRepository;
    }

    public List<RoleSensitiveEntity> findByRoleId(Integer roleId){

        LambdaQueryWrapper<RoleSensitiveEntity> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.select(RoleSensitiveEntity::getId, RoleSensitiveEntity::getRoleId, RoleSensitiveEntity::getSensitiveType)
                .eq(RoleSensitiveEntity::getRoleId, roleId);
        return list(lambdaQueryWrapper);

    }


}

